//微信小程序的基本配置
const appId = "wx65e0d8dffaf1f04d";
const appSecret = "abff06a00b6be5e8cf4da525bbb0a91d";

//jwt,需要npm安装:npm i jsonwebtoken
const jwt = require("jsonwebtoken");

//加密
function getToken(openid){
	return jwt.sign({openid:openid},appSecret,{expiresIn:60*60*24});//expiresIn过期时间
}
//解密
function verifyToken(token){
	return jwt.verify(token,appSecret)
}

module.exports = {
	appId: appId,
	appSecret: appSecret,
	getToken:getToken,
	verifyToken:verifyToken
}
